{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "negative-sussex",
   "metadata": {},
   "outputs": [],
   "source": [
    "from rdkit import Chem\n",
    "from rdkit.Chem import PandasTools\n",
    "from rdkit import RDConfig\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "complete-conversation",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AMW</th>\n",
       "      <th>CLOGP</th>\n",
       "      <th>CP</th>\n",
       "      <th>CR</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>122.12344</td>\n",
       "      <td>0.79</td>\n",
       "      <td>0.727;-0P;4.71</td>\n",
       "      <td>2.963;-40R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>332.495</td>\n",
       "      <td>4.66</td>\n",
       "      <td>4.316;-0P;4.71</td>\n",
       "      <td>9.384;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>218.553</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>2.239;-57P;4.71</td>\n",
       "      <td>4.556;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>145.14184</td>\n",
       "      <td>-2.01</td>\n",
       "      <td>0.519;-59P;4.71</td>\n",
       "      <td>3.267;-42R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>223.231</td>\n",
       "      <td>2.43</td>\n",
       "      <td>1.869;-0P;4.71</td>\n",
       "      <td>6.390;-0R;4.71</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         AMW  CLOGP               CP               CR\n",
       "0  122.12344   0.79   0.727;-0P;4.71  2.963;-40R;4.71\n",
       "1    332.495   4.66   4.316;-0P;4.71   9.384;-0R;4.71\n",
       "2    218.553  -2.61  2.239;-57P;4.71   4.556;-0R;4.71\n",
       "3  145.14184  -2.01  0.519;-59P;4.71  3.267;-42R;4.71\n",
       "4    223.231   2.43   1.869;-0P;4.71   6.390;-0R;4.71"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = PandasTools.LoadSDF(os.path.join(RDConfig.RDDataDir,'NCI','first_200.props.sdf'))\n",
    "df[['AMW','CLOGP','CP','CR']].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "63de62cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "permanent-liechtenstein",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['AMW', 'CLOGP', 'CP', 'CR', 'DAYLIGHT.FPG', 'DAYLIGHT_CLOGP', 'FP',\n",
       "       'ISM', 'LIPINSKI_VIOLATIONS', 'NUM_HACCEPTORS', 'NUM_HDONORS',\n",
       "       'NUM_HETEROATOMS', 'NUM_LIPINSKIHACCEPTORS', 'NUM_LIPINSKIHDONORS',\n",
       "       'NUM_RINGS', 'NUM_ROTATABLEBONDS', 'NUM_ROTATABLEBONDS_O', 'P1',\n",
       "       'SMILES', 'ID', 'ROMol'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "careful-netherlands",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<module 'rdkit.Chem.PandasTools' from '/scratch/RDKit_git/rdkit/Chem/PandasTools.py'>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# NBVAL_IGNORE_OUTPUT\n",
    "import importlib\n",
    "importlib.reload(PandasTools)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "identical-finder",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AMW</th>\n",
       "      <th>CLOGP</th>\n",
       "      <th>CP</th>\n",
       "      <th>CR</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>122.12344</td>\n",
       "      <td>0.79</td>\n",
       "      <td>0.727;-0P;4.71</td>\n",
       "      <td>2.963;-40R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>332.495</td>\n",
       "      <td>4.66</td>\n",
       "      <td>4.316;-0P;4.71</td>\n",
       "      <td>9.384;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>218.553</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>2.239;-57P;4.71</td>\n",
       "      <td>4.556;-0R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>145.14184</td>\n",
       "      <td>-2.01</td>\n",
       "      <td>0.519;-59P;4.71</td>\n",
       "      <td>3.267;-42R;4.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>223.231</td>\n",
       "      <td>2.43</td>\n",
       "      <td>1.869;-0P;4.71</td>\n",
       "      <td>6.390;-0R;4.71</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         AMW  CLOGP               CP               CR\n",
       "0  122.12344   0.79   0.727;-0P;4.71  2.963;-40R;4.71\n",
       "1    332.495   4.66   4.316;-0P;4.71   9.384;-0R;4.71\n",
       "2    218.553  -2.61  2.239;-57P;4.71   4.556;-0R;4.71\n",
       "3  145.14184  -2.01  0.519;-59P;4.71  3.267;-42R;4.71\n",
       "4    223.231   2.43   1.869;-0P;4.71   6.390;-0R;4.71"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['AMW','CLOGP','CP','CR']].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7cea7bba",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
